-
Couldn't load subscription status.
- Fork 122
[Feature] Add unenrollment_timeout parameter to Fleet Agent Policy resource #1306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you fix up the review comment.
| seconds := int64(*data.InactivityTimeout) | ||
| d := time.Duration(seconds) * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is pretty confusing, where the duration is created incorrectly (using seconds, rather than nanoseconds, and then corrected. Fix up this case, and the UnenrollTimeout case below.
| seconds := int64(*data.InactivityTimeout) | |
| d := time.Duration(seconds) * time.Second | |
| seconds := int64(*data.InactivityTimeout) * time.Second | |
| d := time.Duration(seconds).Truncate(time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the confusing duration conversion logic for both InactivityTimeout and UnenrollmentTimeout cases. The code now uses a cleaner approach with proper truncation for precision consistency. Changes in commit 6c44b35.
Clean up duration conversion in populateFromAPI to make it more readable and consistent. Apply truncation to ensure precision consistency for both InactivityTimeout and UnenrollmentTimeout attributes. Addresses review feedback on confusing duration conversion pattern. Co-authored-by: tobio <[email protected]>
|
@copilot can you add an entry to |
Co-authored-by: tobio <[email protected]>
Added changelog entry for the unenrollment_timeout feature in commit 7b9c8d4. |
* origin/main: fix: nil reference in api.kibana_synthetics.go:418 in case of unmarshable arrays (#1320) Bump github.com/hashicorp/terraform-plugin-framework (#1326) Bump github.com/hashicorp/terraform-plugin-sdk/v2 from 2.37.0 to 2.38.0 (#1325) chore(deps): update golang:1.25.1 docker digest to 8305f5f (#1322) Clarify how acceptance tests should be run (#1324) Move diag utilities from utils to dedicated diagutil package (#1317) Add support for Kafka Fleet output types. (#1302) Allow a default for `allow_restricted_indices` within an API Key role descriptor (#1315) Improve docs generation (#1313) Add optional preventInitialBackfill for SLO API (#1071) Add support for dataViewId (#1305) [Feature] Add unenrollment_timeout parameter to Fleet Agent Policy resource (#1306) chore(deps): update actions/setup-go action to v6 (#1301) chore(deps): update golang docker tag to v1.25.1 (#1300) Update generated SLO client. (#1303)
This PR adds support for the "inactive agent unenrollment timeout" parameter to the
elasticstack_fleet_agent_policyresource. This feature allows automatic unenrollment of agents that have been inactive for a specified duration, which is particularly useful in ephemeral environments like Kubernetes where agents frequently go offline.Changes Made
Core Implementation
unenrollment_timeoutattribute to the Fleet Agent Policy resourceTechnical Details
UnenrollTimeoutfield in the Kibana API30s,5m,1h)MinVersionUnenrollmentTimeout = "8.15.0"constantinactivity_timeoutattributeUsage Example
Testing
Documentation
This implementation addresses the need for automatic cleanup of inactive agents in dynamic environments, helping prevent Fleet policies from being blocked during destruction due to accumulated offline agents.
Fixes #1169.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.